/**
 * 
 */
package es.uned.eped.tad.interfaces;

import java.lang.reflect.Array;
import java.util.Arrays;

import es.uned.eped.tad.interfaces.ComparatorIF;

/**
 * @author Paloma
 *
 */
public abstract class ComparatorBase<T> implements ComparatorIF<T>{

	Integer entero;
	Array array;
	@Override
	public int compare(T e1, T e2) {
		if(e1.getClass() == entero.getClass() && 
		   e2.getClass() == entero.getClass()){
			if((Integer)e1==(Integer)(e2)) return EQUAL;
			if((Integer)e1 < (Integer)(e2)) return LESS;
			if((Integer)e1 > (Integer)(e2)) return GREATER;
		}
		
		if(e1.getClass() == array.getClass() && 
				   e2.getClass() == array.getClass()){
					if((Integer)e1==(Integer)(e2)) return EQUAL;
					if((Integer)e1 < (Integer)(e2)) return LESS;
					if((Integer)e1 > (Integer)(e2)) return GREATER;
				}

		return LESS;
	}

	@Override
	public boolean isLess(T e1, T e2) {
		
		return (compare(e1, e2) == LESS);
	}

	@Override
	public boolean isEqual(T e1, T e2) {
		// TODO Auto-generated method stub
		return (compare(e1, e2) == EQUAL);
	}

	@Override
	public boolean isGreater(T e1, T e2) {
		// TODO Auto-generated method stub
		return (compare(e1, e2) == GREATER);
	}

	/**
	 * 
	 */
	

}
